import request from '@/utils/request'
import type { ProcessDefinitionVo } from '@/types/process'

// 获取流程定义列表
export function getFlowDefinitions(params: { pageNo: number; pageSize: number; key?: string }) {
  return request<{
    list: ProcessDefinitionVo[]
    total: number
  }>({
    url: '/definition/list',
    method: 'post',
    params,
  })
}

// 更新流程定义状态（激活/挂起）
export function updateDefinitionState(id: string) {
  return request({
    url: `/definition/state/${id}`,
    method: 'post',
  })
}

// 获取流程定义XML
export function getDefinitionXml(id: string) {
  return request<{
    xmlStr: string // 根据实际返回的字段名调整
  }>({
    url: `/definition/xml/${id}`,
    method: 'get',
  })
}
